<script type="text/javascript">
	function doSearchDate(){   
		$('#dg').datagrid('load',{   
			date1: $('#dd1').datebox("getValue"),   
			date2: $('#dd2').datebox("getValue")
		}); 
	}
	
	function doSearchNum(){
		$('#dg').datagrid('load',{
			num: $('#num').val()
		});
	}
	
	$(function(){
		$('#dg').datagrid({
			view: detailview,
			detailFormatter:function(index,row){
				return '<div class="ddv"><table>' +
				'<tr><td style="border:0; padding:2px 8px;">用车事由: </td>' +
				'<td style="border:0; padding:2px 8px;">' + row.description + '</td></tr>' +
				'<tr><td style="border:0; padding:2px 8px;">备注: </td>' +
				'<td style="border:0; padding:2px 8px;">' + row.comment + '</td></tr>' +
				'</table></div>';
			},
		});
	});
</script>

<table id="dg" title="我的用车报表" class="easyui-datagrid"
		url="<?php echo url('my','carlist')?>"
		toolbar="#toolbar" pagination="true"
		rownumbers="true" showFooter="true" fitColumns="true" fit="true" singleSelect="true">
	<thead>
		<tr>
			<th field="num" width="50">编号</th>
			<th field="date" width="50">日期</th>
			<th field="uname" width="50">用车人</th>
			<th field="driver" width="50">车主</th>
			<th field="car_id" width="50">车牌号</th>
			<th field="colleague" width="100">随行人员</th>
			<th field="destination" width="50">去向</th>
			<th field="amount_estimated" width="50">预估价</th>
			<th field="amount_real" width="50">实际价</th>
		</tr>
	</thead>
</table>
<div id="toolbar" style="padding:5px;height:auto">
	<div  style="margin-bottom:5px">
		<label>按单据编号：</label><input id="num" />
		<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearchNum()">重新统计</a>
	</div>
	<div>
		<label>按日期范围：</label><input id="dd1" name="dd1" class="easyui-datebox" /><label>至</label><input id="dd2" name="dd2" class="easyui-datebox" />
		<a href="#" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="doSearchDate()">重新统计</a>
	</div>
</div>
